/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.comac.ins.common.core.domain.R;
import com.comac.ins.common.web.core.BaseController;
import com.comac.ins.isfd.domain.vo.IsfdBusinessDatabaseRefTreeVo;
import com.comac.ins.isfd.service.IIsfdBusinessDatabaseRefService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 业务场景-数据库类型-模型关联关
 *
 * @author hxloongs
 * @date 2025-03-03
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/isfd/businessDatabaseRef")
public class IsfdBusinessDatabaseRefController extends BaseController {

    @Autowired
    private IIsfdBusinessDatabaseRefService isfdBusinessDatabaseRefService;


    /**
     * 查询数据资产-左侧树v3
     */
    @SaCheckPermission("isfd:businessDatabaseRef:tree")
    @GetMapping("/tree/v3")
    public R<List<IsfdBusinessDatabaseRefTreeVo>> treeV3(@RequestParam("dataBaseName") String dataBaseName,
                                                         @RequestParam(value = "matchName", required = false) String matchName) {
        return R.ok(isfdBusinessDatabaseRefService.baseTreeV3(dataBaseName, matchName));
    }

    /**
     * 系统地图-创建地图-左侧树v3
     */
    @SaCheckPermission("isfd:businessDatabaseRef:tree")
    @GetMapping("/map/tree/v3")
    public R<List<IsfdBusinessDatabaseRefTreeVo>> mapTreeV3(@RequestParam("sceneId") Long sceneId,
                                                            @RequestParam("systemId") Long systemId) {
        return R.ok(isfdBusinessDatabaseRefService.mapTreeV3(sceneId, systemId));
    }
}

